<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<html>
<head>
<base href="<%=basePath%>">
<title>注册页面</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="stylesheet" type="text/css" href="${base}/css/bootstrap.css">
<link href="${base}/css/font-awesome.css?v=4.4.0" rel="stylesheet">
<!-- Sweet Alert -->
<link href="${base}/css/plugins/sweetalert/sweetalert.css"
	rel="stylesheet">
<link href="${base}/css/animate.css" rel="stylesheet">

<script type="text/javascript" src="${base}/js/jquery-3.1.0.js"></script>
<script type="text/javascript" src="${base}/js/bootstrap.js"></script>
<script src="${base}/js/content.js?v=1.0.0"></script>
<!-- Sweet alert -->
<script src="${base}/js/plugins/sweetalert/sweetalert.min.js"></script>

<script>
		$(function(){
			
			$("#userName").blur(function(){
				var userName = $(this).val();
				
				if(userName != ""){
					$.post("${ pageContext.request.contextPath }/user/checkUserName",{"userName":userName},function(data){
		 				if(data == 1){
		 					$("#s1").html("<font color='green'>该用户名可用</font>");
		 					$("#regBut").attr("disabled",false);
		 				}else if(data == 2){
		 					$("#s1").html("<font color='red'>该用户名已被占用</font>");
		 					$("#regBut").attr("disabled",true);
	 	 				}
	 	 			});
	 			}else{
	 				$("#s1").html("<font color='red'>用户名不能为空</font>");
	 				$("#regBut").attr("disabled",true);
	 			}
	 		});
	 		
	 	});
			
</script>
</head>

<body>
	<div class="container">
		<jsp:include page="${path}/menu.jsp"></jsp:include>

		<div class="container"
			style="width:100%;background:url('${ pageContext.request.contextPath }/img/regist_bg.jpg');">
			<div class="row">

				<div class="col-md-2"></div>

				<div class="col-md-8"
					style="background: #fff; padding: 40px 80px; margin: 30px; border: 7px solid #ccc;">
					<font class="regist">注册</font>USER REGISTER
					<form class="form-horizontal" style="margin-top: 5px;"
						method="post"
						action="${ pageContext.request.contextPath }/user/regist">
						<input type="hidden" name="method" value="regist">
						<div class="form-group">
							<label for="userName" class="col-sm-2 control-label">用户名</label>
							<div class="col-sm-6">
								<input type="text" class="form-control" id="userName"
									name="userName" placeholder="请输入用户名">
							</div>
							<span id="s1"></span>
						</div>
						<div class="form-group">
							<label for="inputPassword3" class="col-sm-2 control-label">密码</label>
							<div class="col-sm-6">
								<input type="password" class="form-control" id="password"
									name="password" placeholder="请输入密码">
							</div>
						</div>
						<div class="form-group">
							<label for="confirmpwd" class="col-sm-2 control-label">确认密码</label>
							<div class="col-sm-6">
								<input type="password" class="form-control" id="repassword"
									name="repassword" placeholder="请输入确认密码">
							</div>
						</div>

						<div class="form-group">
							<label for="usercaption" class="col-sm-2 control-label">姓名</label>
							<div class="col-sm-6">
								<input type="text" class="form-control" id="name"
									name="name" placeholder="请输入姓名">
							</div>
						</div>
						
						<div class="form-group">
							<label for="inputEmail3" class="col-sm-2 control-label">Email</label>
							<div class="col-sm-6">
								<input type="email" class="form-control" id="inputEmail3"
									name="email" placeholder="Email">
							</div>
						</div>

						<div class="form-group">
							<div class="col-sm-offset-2 col-sm-10">
								<button type="submit" class="btn btn-success" id="regBut"
									style="width: 280px" >注册</button>
							</div>
						</div>
					</form>
				</div>


			</div>
		</div>

</body>
<script type="text/javascript">
	
</script>
</html>


